package com.igame.mapper;

import com.igame.entity.Collect;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CollectMapper {

    @Insert("insert into collect(id, user_id, goods_id) VALUES (null,#{userId},#{goodsId})")
    int InsertCollect(Integer userId,Integer goodsId);

    @Delete("DELETE from collect where user_id=#{userId} and goods_id =#{goodsId} ")
    int deleteCollect(Integer userId,Integer goodsId);

    @Select("SELECT * FROM collect where user_id=#{userId} and goods_id =#{goodsId}")
    Collect selectCollect(Integer userId,Integer goodsId);

    @Select("select goods_id from collect where user_id=#{id}")
    List<Integer> selectByUserId(Integer id);
}
